package edu.mse.camel.client.session.handlers;

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;

import edu.mse.camel.client.session.team.TEAMMEMBER_STATUS;
import edu.mse.camel.client.session.team.TeamList;
import edu.mse.camel.client.session.views.SessionDialog;

public class JoinSessionHandler implements IHandler {

	@Override
	public void addHandlerListener(IHandlerListener handlerListener) {
		// TODO Auto-generated method stub

	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		SessionDialog sessionDialog = new SessionDialog();
		sessionDialog.joinSession();
		return null;
	}

	@Override
	public boolean isEnabled() {
		if (TeamList.getInstance().getMyStatus().equals(TEAMMEMBER_STATUS.ONLINE)) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean isHandled() {
		return true;
	}

	@Override
	public void removeHandlerListener(IHandlerListener handlerListener) {
		// TODO Auto-generated method stub

	}

}
